import React from 'react';
import { object, func } from 'prop-types';
import moment from 'moment';
const propTypes = {
  item: object
};
function CouponItem({ item }) {
  const { title, expireTime, value, type, state } = item;
  return (
    <div className={`item ${state == 0 ? 'expire' : 'useful'}`}>
      <div className="wrapper">
        <div className="left">
          <span>
            <small>￥</small>
            <span className="f20">{value}</span>
          </span>
          <span className="f14">{type == 1 ? '满减券' : '立减券'}</span>
        </div>
        <div className="right">
          <span className={`title ${state == 0 ? 'expire' : ''}`} title={title}>
            {title}
          </span>
          <span className="cbb f14" style={{ textAlign: 'right' }}>
            有效期至:&nbsp;{moment(expireTime).format('YYYY-MM-D')}
          </span>
        </div>
      </div>
    </div>
  );
}
CouponItem.propTypes = propTypes;
export default CouponItem;
